
#include <sensor_msgs/point_cloud2_iterator.hpp>
#include <tf2/buffer_core.h>
#include <lidar209_msgs/msg/lidar209_scan_ch88.hpp>

#include <memory>
#include <string>

#include "datacontainerbase.hpp"

namespace lidar209_pointcloud
{
class OrganizedCloudXYZIR final
  : public lidar209_rawdata::DataContainerBase
{
public:
  explicit OrganizedCloudXYZIR(
    const double min_range, const double max_range, const std::string & target_frame,
    const std::string & fixed_frame, const unsigned int num_lasers,
    const unsigned int scans_per_block, tf2::BufferCore & buffer);

  void newLine() override;

  void setup(const lidar209_msgs::msg::Lidar209ScanCH88::SharedPtr scan_msg) override;

  void addPoint(
    float x, float y, float z, const uint16_t ring,
    const float distance, const float intensity) override;

private:
  sensor_msgs::PointCloud2Iterator<float> iter_x_, iter_y_, iter_z_, iter_intensity_;
  sensor_msgs::PointCloud2Iterator<uint16_t> iter_ring_;
};
}  // namespace lidar209_pointcloud

